package cn.blackhole.simple.domain.retry.service.impl;

import cn.blackhole.simple.domain.retry.service.RetryPolicy;

import java.io.IOException;

public class Type1RetryPolicy implements RetryPolicy {

    @Override
    public int maxAttempts() {
        return 3;
    }

    @Override
    public long delayMillis(int attempt) {
        return 1000;
    }

    @Override
    public boolean shouldRetry(Throwable... e) {
        return e[0] instanceof IOException;
    }
}
